﻿using System;
using System.Collections.Generic;
using System.Text;
using DevComponents.DotNetBar;

namespace AMS.UI.Menu
{
    /// <summary>
    /// 与dotnetBar绑定的窗体显示控件
    /// </summary>
    public class BarFormShowAction : FormShowAction
    {
        private static BarFormShowAction instance;
        /// <summary>
        /// 单实例
        /// </summary>
        public static BarFormShowAction Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new BarFormShowAction();
                }

                return instance;
            }
        }

        /// <summary>
        /// 处理点击之前的事件
        /// </summary>
        /// <param name="menuItem"></param>
        /// <param name="handled"></param>
        public override void BeforeProcessMenuClick(object menuItem, ref bool handled)
        {
            ButtonItem bar = (ButtonItem)menuItem;
            BeforeClick(bar.Tag as string, ref handled);
        }

        /// <summary>
        /// 处理点击的事件
        /// </summary>
        /// <param name="menuItem"></param>
        public override void OnMenuClick(object menuItem)
        {
            ButtonItem bar = (ButtonItem)menuItem;
            DoMenuClick(bar.Tag as string);
        }
    }
}
